# $Id: PKGBUILD 89228 2013-04-28 06:44:15Z tpowa $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: J. Santiago Hirschfeld <jsantiagoh@yahoo.com.ar>

pkgname=cdfs
pkgver=2.6.27
_extramodules=extramodules-3.8-ARCH # Don't forget to update cdfs.install
pkgrel=42
pkgdesc="File system module that 'exports' all tracks and boot images on a CD as normal files."
arch=(i686 x86_64)
url="http://www.elis.UGent.be/~ronsse/cdfs/"
license=('GPL')
depends=('linux>=3.8' 'linux<3.9')
makedepends=('linux-headers')
install=cdfs.install
source=("http://www.elis.UGent.be/~ronsse/cdfs/download/$pkgname-$pkgver.tar.bz2"
	"cdfs-3.0.patch"
	"cdfs-3.2.patch"
	"cdfs-3.4.patch"
	"cdfs-3.8.patch")
md5sums=('ac64c014a90e3c488394832ea29605b3'
         'aba7da94a9dcbb8a93ea423cb6958fef'
         'e934407b3460257a301822ffc4ab3933'
         '9215e7bdac728bd2f889fb525e543454'
         'b036fd72b033294605bec2b60a73e3bd')

build() {
  _kernver="$(cat /usr/lib/modules/${_extramodules}/version)"

  cd $srcdir/$pkgname-$pkgver
  patch -p1 <$srcdir/cdfs-3.0.patch
  patch -p1 <$srcdir/cdfs-3.2.patch
  patch -p1 <$srcdir/cdfs-3.4.patch
  patch -p1 <$srcdir/cdfs-3.8.patch
  make KDIR=/usr/lib/modules/${_kernver}/build
  sed -i "s/EXTRAMODULES='.*'/EXTRAMODULES='$_extramodules'/" $startdir/cdfs.install
}

package() {
  cd $srcdir/$pkgname-$pkgver
  install -Dm0644 cdfs.ko $pkgdir/usr/lib/modules/$_extramodules/cdfs.ko
}
